<?php

/**
 * This is the model class for table "adv_click_history".
 *
 * The followings are the available columns in table 'adv_click_history':
 * @property string $adv_click_history_id
 * @property string $owner_id
 * @property string $adv_id
 * @property string $referer
 * @property string $data
 * @property string $created
 */
class AdvClickHistory extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return AdvClickHistory the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'adv_click_history';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('website_id, owner_id, adv_id, data, adddate', 'required'),
			array('owner_id, adv_id', 'length', 'max'=>10),
			array('referer', 'length', 'max'=>255),
			array('website', 'length', 'max'=>255),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('adv_click_history_id, owner_id, adv_id, referer, data, adddate', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'adv_click_history_id' => 'Adv Click History',
			'website_id' => 'website_id',
			'website' => 'website',
			'owner_id' => 'Owner',
			'adv_id' => 'Adv',
			'referer' => 'Referer',
			'data' => 'Data',
			'adddate' => 'Date',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('adv_click_history_id',$this->adv_click_history_id,true);
		$criteria->compare('website_id',$this->website_id,true);
		$criteria->compare('website',$this->website,true);
		$criteria->compare('owner_id',$this->owner_id,true);
		$criteria->compare('adv_id',$this->adv_id,true);
		$criteria->compare('referer',$this->referer,true);
		$criteria->compare('data',$this->data,true);
		$criteria->compare('adddate',$this->adddate,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}